Repository navigation
Fix lab CLI lines and Python/Terraform snippets found by replaying every lab - #82
Merged
Merged
Conversation
…ery lab
Lab commands:
- Organizations create-policy lines pass the required --description.
- Shorthand values with {a,b} are quoted, so the shell doesn't brace-expand them
(Lambda environment, Firehose buffering hints, CodeBuild environment and report
export, RI budget, put-metric-data dimensions, ECS network configuration,
SageMaker input channels).
- apigatewayv2 create-stage quotes '$default', which the shell would empty.
- The guided EC2 send-command uses a JSON list the CLI accepts.
- SQS batch entry files and the EventBridge targets file hold the list the CLI
option expects; the SQS create-queue attributes file is an attributes map.
Snippets:
- Python catches the errors a lab marks as expected (refused, denied, ...) so
the rest of the script still runs.
- CLI doubles render as plain numbers instead of an unimported Decimal.
- Abbreviated or placeholder shorthand keeps placeholders and drops fragments
that only half-parse.
- Terraform flow logs use log_destination (AWS provider 6 removed log_group_name).
Tests: every complete CLI line parses with the AWS CLI, every lab command
survives the shell, every artifact fits its CLI parameter, and every boto3
snippet's literal values fit the API shapes and use only defined names.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A role policy, group membership, event rule or subscription named its parent with a literal string, so terraform apply could create it before the parent and fail with NoSuchEntity / not found. Names and ARNs of resources declared earlier in a snippet now become references (aws_iam_role.x.name, .arn), which orders creation. All 359 Terraform snippets pass terraform validate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`--instance-ids i-1 ... commands=[...]` put the commands into InstanceIds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eates
A step that creates a KMS key and then aliases <key-id>, or a security group
and then adds rules to <web-sg-id>, asked for the ID as a variable, so one
apply could never work. Those placeholders now reference the resource
(aws_kms_key.x.key_id, aws_security_group.x.id, ...) and the unused variable
goes away. KMS TagKey/TagValue tags render as a map instead of { None = null }.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Chris
What
I checked every lab's CLI, Python and Terraform snippets (120 labs, 810 steps) and fixed the bugs that would break for a learner who copies them.
How they were checked
awsline went through the AWS CLI's own argument parser, and every lab command through bash quoting rules.terraform validatewith AWS provider 6.72, thenapplyanddestroyper step on a second throwaway Floci.Lab command fixes
create-policywas missing the required--description(SCPs and the tag policy).{a,b}was brace-expanded by the shell into two arguments. Affected: Lambda--environment, Firehose buffering hints, CodeBuild environment and report export, the RI budget,put-metric-datadimensions, ECS--network-configurationand SageMaker input channels.--stage-name $defaultwas emptied by the shell. It now reads'$default'.send-commandusedcommands='… "…"', which the CLI rejects.{"Entries": [...]}and the EventBridge targets file held one object.--entriesand--targetstake the list itself.create-queue --attributesfile was a bare policy. It is now an attributes map withPolicy.Snippet generator fixes (
snippets.py)…Exception) intry/except ClientError, so the rest of the script still runs.Decimal(...)with no import....) or placeholder shorthand keeps<placeholders>(numbers become named constants) and drops fragments that only half-parse, such asEntries=[{'ref': ...}].aws_flow_loguseslog_destination, because provider 6 removedlog_group_name.New tests
Tests
python manage.py test --noinput: 2,155 passruff check .: clean🤖 Generated with Claude Code